package com.zhangpingyang.jwttoken.config;

import com.zhangpingyang.jwttoken.nosql.elasticsearch.model.EsProduct;
import com.zhangpingyang.jwttoken.service.EsProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

/**
 * @Author: Zhang Pingyang
 * @Date: 2019/11/11 11:03
 */
@Configuration
@EnableScheduling
public class SpringTaskConfig {
    @Autowired
    private EsProductService esProductService;

    @Scheduled(cron = "0/10 * * ? * ?")
    private void cancelTimeoutOrder() {
        Iterable<EsProduct> search = esProductService.search(null, null, null);
        System.out.println("cancel timeout order");
    }
}
